<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Blog</title>
    <link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/lib/bootstrap-3.3.7/dist/css/bootstrap.min.css" />
	<link rel="stylesheet"
	href="${pageContext.request.contextPath }/lib/font-awesome-4.7.0/css/font-awesome.css">
	
	<!-- <link href="webstyle.css" rel="stylesheet"/> -->
	<style>
		a {
            text-decoration: none;
        }
        .main {
            max-width:1200px;
            min-height:500px;
            margin:20px auto;
        }
        .texta { 
            width:80%; 
            margin:0 auto;
        }
        .texta textarea {
             width:100%; 
             height:100px;
        }
        .send {
            float:right;
        }
        .webcontent { 
            position:relative;
            width:80%; 
            margin:50px auto;
            padding: 10px;
            /* background:#ddd; */
            background: rgba(98, 98, 98, .09);
            min-height:100px
        }
        .yizan { 
            position:absolute;
            padding: 10px;
            bottom:0px;
            left:0px
        }
        .zan { 
            position:absolute; 
            padding: 10px;
            bottom:0px;
            right:0px
        }
        .delete { 
            position:absolute;
            padding: 10px;
            right:0px
        }
        .btn-containal {
        	padding: 10px 0;
        }
	</style>
  </head>
  
  <body>
  
    <div class="main">
        <div class="texta">
            <form action="${pageContext.request.contextPath }/servlet/TopicAction" method="post">
                <div class="form-group">
                    <textarea id="webtext" name="webtext" placeholder="说点什么吧..." name="webtext"></textarea> 
                </div>
                <div class="form-group btn-containal">
                    <button type="submit" class="btn btn-default send">提交</button>
                </div>
            </form>
        </div>
        <c:if test="${!empty requestScope.meAndAllFriendTopic}">
        	<c:forEach var="t" items="${requestScope.meAndAllFriendTopic}">
        		<div class="webcontent">
        			<a href="##">
        				<c:if test="${sessionScope.loginUser.userName != t.users.userName }"> 
        					${t.users.niceName}:
        				</c:if>
        				<c:if test="${sessionScope.loginUser.userName == t.users.userName }"> 
        					自己:
        				</c:if>
        			
        		    </a> ${t.webtext}
        			<a class="yizan"> 
	        			<c:if test="${!empty t.list}">
	        				<c:forEach var="v" items="${t.list}">
	        					${v.niceName } 
	        				</c:forEach>
	        				已点赞
	        			</c:if>
        			
        			</a>
        			<a class="zan" href="${pageContext.request.contextPath }/servlet/DianpraiseAction?topicId=${t.topicId }">点赞(${t.praisecount })</a> 
        		<c:if test="${sessionScope.loginUser.userName == t.users.userName }"> 
        			<a href="${pageContext.request.contextPath }/servlet/DeleteAction?topicId=${t.topicId }" class="delete">删除</a>
        		</c:if>
        		</div>
        	</c:forEach> 
        </c:if>
    </div>
    
  </body>
  <script src="${pageContext.request.contextPath }/lib/jquery/jquery.js" type="text/javascript"
	charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/lib/bootstrap-3.3.7/dist/js/bootstrap.min.js"
	type="text/javascript" charset="utf-8"></script>
</html>
